﻿<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <title>美宜佳，更亲近的伙伴</title>
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400">  <!-- Google web font "Open Sans" -->
  <link rel="stylesheet" href="./resources/css/font-awesome.min.css">
  <link rel="stylesheet" href="./resources/css/bootstrap.min.css">
  
  <link rel="stylesheet" href="./resources/css/demo.css" />
  <link rel="stylesheet" href="./resources/css/templatemo-style.css">
  <link rel="shortcut icon" href="./resources/images/favicon.ico">
  <script type="text/javascript" src="./resources/js/modernizr.custom.86080.js"></script>
		
	</head>

	<body>
        <!-- 动态背景 -->
		<div id="particles-js"></div>
            <!-- 别删 -->
			<ul class="cb-slideshow">
	            <li></li>
	            <li></li>
	            <li></li>
	            <li></li>
	            <li></li>
	            <li></li>
	        </ul>

			<div class="container-fluid">
				<div class="row cb-slideshow-text-container ">
					<div class= "tm-content col-xl-6 col-sm-8 col-xs-8 ml-auto section">
					<header class="mb-5"><h1 style="color: yellow;">美宜佳</h1></header>
					<P>让消费者享受美好的便利生活</P>
					<p>让奋斗者收获美满的幸福人生</p>					
					<p class="mb-5">为社会进步作出贡献</P>
					<!-- subscribe-form -->
                    <form action="#" class="subscribe-form layui-form">
               	    	<div class="form-section">

							<div class="col-md-7 col-sm-7 col-xs-7">
			                    <input name="username" type="text" class="form-control" id="contact_email" placeholder="用户名" lay-verify="required" autocomplete="off" value="system"/>
								<span style="margin: 3px;"></span>
								<input type="password" name="password" lay-verify="required" placeholder="密码" autocomplete="off" class="form-control" value="123456">
				  			</div>

							<!-- class="col-md-5 col-sm-5 col-xs-5" -->
							<div >
								<!-- <button class="layui-btn layui-btn-fluid" lay-submit="" lay-filter="login">登 入</button> -->
								<button type="submit" class="tm-btn-subscribe col-md-4" lay-submit="" lay-filter="login" style="margin-left: 100px; margin-top: 20px;">登录</button>
							</div>
						
						</div>
                    </form>
                    
				

					</div>
				</div>	
				<div class="footer-link">
					<p>Copyright © 2021 Meiyijia
                    
                    - Design: <a rel="nofollow" href="#" target="_parent">Templatemo</a></p>
                   
				</div>
			</div>	
	<style>
.copyrights{text-indent:-9999px;height:0;line-height:0;font-size:0;overflow:hidden;}
</style>

	<script src="resources/lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
	<script src="resources/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
	<script src="resources/lib/jq-module/jquery.particleground.min.js" charset="utf-8"></script>
	<!-- 一定放在jquery后面,依赖的关系 -->
	<script src="resources/lib/common/jquery.cookie.min.js" charset="utf-8"></script>   
	<script src="resources/lib/common/common.js" charset="utf-8"></script>
	<script>
		  layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer;

        // 登录过期的时候，跳出ifram框架
        if (top.location != self.location) top.location = self.location;



        // 进行登录操作
        form.on('submit(login)', function (data) {
            var btn=$(this);
            btn.text("登 录 中...").attr("disabled","disabled").addClass("layui-disabled");
            $.ajax({
                url:api+"login/doLogin",
                method:"post",
                data:{loginname:data.field.username,password:data.field.password}, //, keyCode:keyCode
                success:function(res){
                    layer.msg(res.msg);
                    if(res.code!=200){
                        btn.text("登 录").attr("disabled",false).removeClass("layui-disabled");
                    }else{
                        //把token写道cookie
                        $.cookie('TOKEN',res.token.token,{expires:7});//登录成功之后把token放到cookie里面
                        localStorage.setItem("permissions",res.token.permissions);
                        localStorage.setItem("usertype",res.token.usertype);
                        localStorage.setItem("username",res.token.username);
                        window.location.href = "/index.html";
                    }
                },
                error:function(){
                    layer.msg("登录失败");
                    btn.text("登 录").attr("disabled","").removeClass("layui-disabled");
                }
            })
           
            return false;
        });
    });
	</script>
</body>

	<script type="text/javascript" src="./resources/js/particles.js"></script>
	<script type="text/javascript" src="./resources/js/app.js"></script>
</html>